[vars]
filesize=3920622
sha512=ac392d916e6953b0925a7cbb0f232affea33339ef69b47a0a7898492afb9784b93138986df53d6da6d3e2ad79af1e9482df565ecca30f89428be0ae6851b1adc

[mirrors]
http://www.libsdl.org/release/SDL-1.2.15.tar.gz

[deps]
libxext

[build]
patch -p1 < "$K"/sdl-stacksize.patch
patch -p1 < "$K"/sdl-grsec.patch

cd src/video/fbcon
sed -i -e "s|__u16|ushort|" -e "s|__u32|uint|" *.c *.h
sed -i "s|defined(FB_TYPE_VGA_PLANES)|defined(DONT_TOUCH_THIS)|" SDL_fbvideo.c
cd ../../..

sed -i '/_XData32/s:register long:register _Xconst long:' src/video/x11/SDL_x11sym.h

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags" \
LDFLAGS="$optldflags" \
CPPFLAGS="-D_GNU_SOURCE -D_BSD_SOURCE -D_XFUNCS_H_" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

